package classes;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class Basket 
{

	List<Product> productList;

    public Basket()
    {
    	productList = new ArrayList<Product>();
    }
    
    public void addProduct(Product product)
    {
    	productList.add(product);
    }
    
	public BigDecimal getTotalBasketPrice() {
        BigDecimal basketPrice = new BigDecimal(0);
        for (Product item : productList) {
            basketPrice.add(item.getPrice());
        }
		 return basketPrice.setScale(2,BigDecimal.ROUND_HALF_UP);
	}


    public List<Product> getProduct() {
        return productList;
    }

    public void setItems(List<Product> product) {
        this.productList = product;
    }

}
